<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

    <meta name="author" content="Janmas">



    <meta name="description" content="Janmas！一个又菜又爱玩的程序猿。不停的在立Flag，又一直在凭实力打着自己的脸。">


    <meta name="keywords" content="Janmas,Blog,墨鱼">


<title>
    Composer源集合 |
    
    Janmas</title>



    <link rel="icon" href="/favicon.ico">



    <!-- stylesheets list from _config.yml -->
    
        <link rel="stylesheet" href="/css/style.css">
    



    <!-- scripts list from _config.yml -->
    
        <script src="/js/script.js"></script>
    
        <script src="/js/tocbot.min.js"></script>
    



    
    
        
    



    <script src='https://unpkg.com/mermaid@7.1.2/dist/mermaid.min.js'></script>
    <script>
        if (window.mermaid) {
            mermaid.initialize({theme: 'forest'});
        }
    </script>


<meta name="generator" content="Hexo 5.4.1"></head>

<body>
    <script>
        // this function is used to check current theme before page loaded.
        (() => {
            const currentTheme = window.localStorage && window.localStorage.getItem('theme') || '';
            const isDark = currentTheme === 'dark';
            const pagebody = document.getElementsByTagName('body')[0]
            if (isDark) {
                pagebody.classList.add('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Dark"
            } else {
                pagebody.classList.remove('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Light"
            }
        })();
    </script>

    <div class="wrapper">
        <header>
    <nav class="navbar">
        <div class="container">
            <div class="navbar-header header-logo"><a href="/">Janmas&#39;s Blog</a></div>
            <div class="menu navbar-right">
                
                    <a class="menu-item" href="/archives">Posts</a>
                
                    <a class="menu-item" href="/category">Categories</a>
                
                    <a class="menu-item" href="/tag">Tags</a>
                
                <input id="switch_default" type="checkbox" class="switch_default">
                <label for="switch_default" class="toggleBtn"></label>
            </div>
        </div>
    </nav>

    
    <nav class="navbar-mobile" id="nav-mobile">
        <div class="container">
            <div class="navbar-header">
                <div>
                    <a href="/">Janmas&#39;s Blog</a><a id="mobile-toggle-theme">·&nbsp;Light</a>
                </div>
                <div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
            </div>
            <div class="menu" id="mobile-menu">
                
                    <a class="menu-item" href="/archives">Posts</a>
                
                    <a class="menu-item" href="/category">Categories</a>
                
                    <a class="menu-item" href="/tag">Tags</a>
                
            </div>
        </div>
    </nav>

</header>
<script>
    var mobileBtn = function f() {
        var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
        var mobileMenu = document.getElementById("mobile-menu");
        if(toggleMenu.classList.contains("active")){
           toggleMenu.classList.remove("active")
            mobileMenu.classList.remove("active")
        }else{
            toggleMenu.classList.add("active")
            mobileMenu.classList.add("active")
        }
    }
</script>
            <div class="main">
                <div class="container">
    
    
        <div class="post-toc">
    <div class="tocbot-list">
    </div>
    <div class="tocbot-list-menu">
        <a class="tocbot-toc-expand" onclick="expand_toc()">Expand all</a>
        <a onclick="go_top()">Back to top</a>
        <a onclick="go_bottom()">Go to bottom</a>
    </div>
</div>

<script>
    document.ready(
        function () {
            tocbot.init({
                tocSelector: '.tocbot-list',
                contentSelector: '.post-content',
                headingSelector: 'h1, h2, h3, h4, h5',
                collapseDepth: 1,
                orderedList: false,
                scrollSmooth: true,
            })
        }
    )

    function expand_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 6,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "collapse_toc()");
        b.innerHTML = "Collapse all"
    }

    function collapse_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 1,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "expand_toc()");
        b.innerHTML = "Expand all"
    }

    function go_top() {
        window.scrollTo(0, 0);
    }

    function go_bottom() {
        window.scrollTo(0, document.body.scrollHeight);
    }

</script>
    

    
    <article class="post-wrap">
        <header class="post-header">
            <h1 class="post-title">Composer源集合</h1>
            
                <div class="post-meta">
                    
                        Author: <a itemprop="author" rel="author" href="/">Janmas</a>
                    

                    
                        <span class="post-time">
                        Date: <a href="#">January 10, 2022&nbsp;&nbsp;15:43:50</a>
                        </span>
                    
                    
                        <span class="post-category">
                    Category:
                            
                                <a href="/categories/Composer/">Composer</a>
                            
                        </span>
                    
                </div>
            
        </header>

        <div class="post-content">
            <blockquote>
<p>自从 Packagist 中国全量镜像服务停止以后，大部分的 phper 都会使用 laravel-chind 的提供的镜像，但是最近因为大量的恶意请求而出现资源告急的情况，已经做了一些限额处理<br>分享一些国内可用的 Composer 全量镜像，速度自测～</p>
</blockquote>
<h4 id="镜像站集合"><a href="#镜像站集合" class="headerlink" title="镜像站集合"></a>镜像站集合</h4><ul>
<li><p>Alibaba Cloud Composer Mirror<br>由阿里提供的镜像，阿里家大业大，大水管<br>镜像地址：<code>https://mirrors.aliyun.com/composer/</code></p>
</li>
<li><p>Laravel China Composer 全量镜像<br>由 Laravel China 社区联合又拍云与优帆远扬共同合作推出的公益项目，将于 2019 年 9 月 4 号停用。<br>镜像地址：<code>https://packagist.laravel-china.org</code></p>
</li>
<li><p>华为云<br>镜像地址：<code>https://mirrors.huaweicloud.com/repository/php/</code></p>
</li>
<li><p>腾讯云<br>镜像地址：<code>https://mirrors.cloud.tencent.com/composer/</code></p>
</li>
<li><p>Composer / Packagist 中国全量镜像<br>由安畅网络赞助的镜像<br>镜像地址：<code>https://php.cnpkg.org</code></p>
</li>
<li><p>Packagist Mirror<br>由上海交通大学提供的镜像<br>镜像地址：<code>https://packagist.mirrors.sjtug.sjtu.edu.cn</code></p>
</li>
<li><p>Packagist / Composer 中国全量镜像<br>由 bootcss 提供的赞助，但是现在好像已经用不了了<br>镜像地址：<code>https://packagist.phpcomposer.com</code></p>
</li>
</ul>
<h4 id="如何修改镜像源"><a href="#如何修改镜像源" class="headerlink" title="如何修改镜像源"></a>如何修改镜像源</h4><p>默认源地址在国外，从国内访问的速度肯定比较慢，所以我们需要修改镜像源，以下以阿里提供的镜像为例，替换对应镜像地址即可</p>
<h5 id="配置只在当前项目生效"><a href="#配置只在当前项目生效" class="headerlink" title="配置只在当前项目生效"></a>配置只在当前项目生效</h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">composer config repo.packagist composer https://mirrors.aliyun.com/composer/</span><br><span class="line">composer config --unset repos.packagist # 取消当前项目配置</span><br></pre></td></tr></table></figure>

<h5 id="配置全局生效"><a href="#配置全局生效" class="headerlink" title="配置全局生效"></a>配置全局生效</h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/</span><br><span class="line">composer config -g --unset repos.packagist # 取消全局配置</span><br></pre></td></tr></table></figure>

<h5 id="使用第三方软件快速修改、切换镜像源"><a href="#使用第三方软件快速修改、切换镜像源" class="headerlink" title="使用第三方软件快速修改、切换镜像源"></a>使用第三方软件快速修改、切换镜像源</h5><p>CRM – Composer 源管理工具：<a href="https://github.com/slince/composer-registry-manager">https://github.com/slince/composer-registry-manager</a></p>
<h5 id="刷新-composer-lock-文件"><a href="#刷新-composer-lock-文件" class="headerlink" title="刷新 composer.lock 文件"></a>刷新 composer.lock 文件</h5><p>使用以下命令：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">composer update nothing</span><br></pre></td></tr></table></figure>
<p>或者：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">composer update --lock</span><br></pre></td></tr></table></figure>

<p><em>-–lock: 只升级 lock 文件的哈希以消除 lock 文件过期的警告</em></p>
<h4 id="测试一下"><a href="#测试一下" class="headerlink" title="测试一下"></a>测试一下</h4><h5 id="清空本地缓存"><a href="#清空本地缓存" class="headerlink" title="清空本地缓存"></a>清空本地缓存</h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rm -rf vendor</span><br><span class="line">composer clear-cache</span><br></pre></td></tr></table></figure>
<h5 id="执行安装命令"><a href="#执行安装命令" class="headerlink" title="执行安装命令"></a>执行安装命令</h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">composer install -vvv</span><br></pre></td></tr></table></figure>
        </div>

        
            <section class="post-copyright">
                
                
                
                

            </section>
        
        <section class="post-tags">
            <div>
                <span>Tag(s):</span>
                <span class="tag">
                    
                    
                        <a href="/tags/composer/"># composer</a>
                    
                        
                </span>
            </div>
            <div>
                <a href="javascript:window.history.back();">back</a>
                <span>· </span>
                <a href="/">home</a>
            </div>
        </section>
        <section class="post-nav">
            
                <a class="prev" rel="prev" href="/2022/01/10/Test-Generate-Deploy/">Generate&Deploy</a>
            
            
            <a class="next" rel="next" href="/2022/01/10/Centos%E5%AE%89%E8%A3%85FFmpeg/">Centos安装FFmpeg</a>
            
        </section>


    </article>
</div>

            </div>
            <footer id="footer" class="footer">
    <div class="copyright">
        <span>© Janmas | Powered by <a href="https://hexo.io" target="_blank">Hexo</a> & <a href="https://github.com/Siricee/hexo-theme-Chic" target="_blank">Chic</a></span>
    </div>
</footer>



    </div>
</body>

</html>